// 这个文件是基于webpack做二次配置的
// 又基于customize-cra
const path = require('path')
const { override, addDecoratorsLegacy, addPostcssPlugins } = require('customize-cra')

function resolve(dir) {
  return path.join(__dirname, dir)
}

const customize = () => (config, env) => {
  config.resolve.alias['@'] = resolve('src')
  if (env === 'production') {
    config.externals = {
      'react': 'React',
      'react-dom': 'ReactDOM'
    }
  }

  return config
};


module.exports = override(addDecoratorsLegacy(), customize(), addPostcssPlugins([require("postcss-px2rem")({ remUnit: 37.5 })]))